package com.shijie.sjoj.service.mapper;

import com.shijie.sjoj.model.component.LocalDateTimeFillAop.LocalDateTimeFill;
import com.shijie.sjoj.model.component.LongFillAop.LongFill;
import com.shijie.sjoj.model.pojo.entity.Judge;
import com.shijie.sjoj.model.pojo.entity.Quiz;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 题目DAO接口
 *
 * @author ZSJ
 */
@Mapper
public interface QuizMapper {

    /**
     * 题目搜索
     *
     * @return List
     */
    List<Quiz> list();

    /**
     * 根据题目id搜索题目
     *
     * @param quizId 题目id
     * @return Quiz
     */
    Quiz getByQuizId(@Param("quizId") Long quizId);

    /**
     * 获取解题必须的题目信息
     *
     * @param quizId 题目
     * @return Judge
     */
    Judge getJudgeRequireInfo(@Param("quizId") Long quizId);

    /**
     * 新增题目
     *
     * @param quizzes 题目列表
     * @return boolean
     */
    @LongFill({LongFill.CREATE_USER_ID, LongFill.UPDATE_USER_ID})
    @LocalDateTimeFill({LocalDateTimeFill.CREATE_TIME, LocalDateTimeFill.UPDATE_TIME})
    boolean saves(@Param("quizzes") List<Quiz> quizzes);

    /**
     * 修正题目
     *
     * @param quiz 题目
     * @return boolean
     */
    boolean modify(@Param("quiz") Quiz quiz);

    /**
     * 销毁题目
     *
     * @param quizIds 题目id列表
     * @return boolean
     */
    boolean destroys(@Param("quizIds") List<Long> quizIds);


}
